home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
FROMUTS
/
GOFER
/
src
/
Readme
< prev
Wrap
Text File
|
1991-11-20
|
5KB
|
110 lines
This directory contains the source for the Gofer interpreter for use with
SunOS 4.x machines (probably SunOS 3.5 too) and Turbo C 1.5 on the PC.
---------------------
For SunOs versions, edit prelude.h to get:
#define TURBOC 0 /* This version for IBM PC, using Turbo C 1.5 */
#define UNIX 1 /* This version for Sun 3/Sun 4 running SunOS 4.x */
and then compile using the Makefile supplied. The script `gofer' in this
directory can be edited to provide a convenient way of starting Gofer,
particularly if you intend using Gofer on both Sun 3 and Sun 4 machines.
The version of parser.c supplied with the Gofer system is specifically
intended to be used to build the PC version of Gofer. When compiling
Gofer on a UNIX based machine, it is usually best to delete this file,
and rely on the version of yacc provided by your system to obtain an
appropriate version of parser.c.
---------------------
For PC version, change the lines above to:
#define TURBOC 1 /* This version for IBM PC, using Turbo C 1.5 */
#define UNIX 0 /* This version for Sun 3/Sun 4 running SunOS 4.x */
and compile from the Turbo C environment using the GOFER.PRJ file supplied,
with MEDIUM model (64K data, upto 1MB code), and stack checking enabled.
Gofer can also be compiled using Turbo C++ (the version I tried was 1.01)
although this resulted in a binary that was 33% bigger than that produced
by Turbo C 1.5. Perhaps this was caused by some unwanted compiler options
(line numbers/debugging information?) but I did not have time to investigate.
Note that the PC version of Gofer does not currently support the use of
floating point numbers. The corresponding section of the standard prelude
file `prelude' must be commented out before Gofer can be used on a PC.
The relevant sections of the prelude are now flagged by lines:
{- PC version off -}
lines which must be excluded
{- PC version on -}
[There are two such sections, beginning in lines 196 and 681 respectively.]
To prepare the prelude file to be used on PCs, edit these lines to get:
{- PC version off
lines which must be excluded
PC version on -}
---------------------
Gofer has not yet been tested on other platforms, although most of the Gofer
code is fairly standard. The code does however make certain assumptions about
the system on which Gofer will be used. These are summarised below as an aid
to those interested in porting Gofer to other systems:
1) For the benefit of Garbage collection from the C stack, all function
parameters and local variables are expected to have sizes which are
a multiple of sizeof(Int) (defined in prelude.h). In other words,
you should check that:
sizeof(FloatImpType) % sizeof(Int) == 0
sizeof(String) % sizeof(Int) == 0
sizeof(Char) % sizeof(Int) == 0
sizeof(Long) % sizeof(Int) == 0
sizeof(Unsigned) % sizeof(Int) == 0
(These types are defined in prelude.h and storage.h)
2) Floating point numbers can only be supported on systems in which
sizeof(float)<=sizeof(Cell)
The symbol HASFLOATS should be #defined in prelude.h if this condition
is satisfied and floating point numbers are required, but should otherwise
be left undefined.
3) The words local and far are used to access non-standard extensions in
Turbo C to allow the Gofer system to overcome some of the limitations of
the PC's segmented architecture. These should be #defined to empty strings
on most other machines with a flat address space.
4) prelude.h should include #defines for bitsPerWord, bitArraySize,
placeInSet and maskInSet which are used to access and manipulate
bit sets. The standard version of prelude.h contains appropriate
versions of these macros for PCs (with 16 bit integers) and SunOs
machines (with 32 bit integers).
5) The current version of the garbage collector assumes that the C stack
grows downwards (i.e. the stack pointer is decremented each time a value
is pushed onto the stack). If you encounter a machine in which the stack
grows upwards, replace the line "markWithoutMove(*ptr++);" in machdep.c
with "markWithoutMove(*ptr--);".
Almost all of the machine dependencies in the code for Gofer are contained
in the header file "prelude.h", and the program file "machdep.c". These
files contain definitions for both the TURBOC and UNIX versions described
above and should be a useful guide.
I regret that I do not have time to write more substantial notes for
porting Gofer at the present time. I will however be happy to offer
advice and answer other questions if you want to contact me in person
at the email address below.
---------------------
NOTE: if Gofer starts behaving unexpectedly, try recompiling
without full compiler optimisation and see if the problem still occurs.
If so, please get in touch with me, giving me as much information about
the problem as possible, and I'll try and sort it out for you. If you
find a bug which you fix yourself, please send me details so that I can
pass the fix onto to other users of Gofer.
mpj@prg.ox.ac.uk